<template>
  <div v-if="istool">
    <el-tooltip class="item" effect="dark" :content="text" :placement="placement">
      <span class="text-overflow">{{ text }}</span>
    </el-tooltip>
  </div>
  <div v-else>
    <span class="text-overflow">{{ text }}</span>
  </div>
</template>

<script>
export default {
  props: {
    text: String,
    placement: {
      default: "left",
      type: String,
    },
    istool: {
      type: Boolean,
      default: true,
    },
  },
};
</script>

<style scoped>
.text-overflow {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
</style>